Some electronic devices employ gravity sensors to automatically rotate virtual images displayed on display screens when the display screens of the electronic devices are rotated. However, sometimes, the rotational values of the display screens of the electronic devices and the rotational values of the virtual images displayed on the display screens are not consistent.